(function(){if(window["RatingLikeComments"])return;var e={},t={};window.RatingLikeComments=function(t,i,s,n){this.likeId=t;this.entityTypeId=i;this.entityId=s;this.available=n=="Y";this.likeTimeout=false;this.enabled=this.init();e[t]=this};window.RatingLikeComments.prototype={init:function(){this.box=BX("bx-ilike-button-"+this.likeId);if(!this.box)return false;BXMobileApp.addCustomEvent("onPull-main",BX.proxy(function(e){if(e.command=="rating_vote"){var t=e.params;if(t.USER_ID+""!=BX.message("USER_ID")+""&&this.entityTypeId==t.ENTITY_TYPE_ID&&this.entityId==t.ENTITY_ID){this.someoneVote(t.TYPE=="ADD",t.TOTAL_POSITIVE_VOTES)}}},this));this.voted=BX.hasClass(this.box,"post-comment-likes-liked");BX.bind(this.box,"click",BX.proxy(this.vote,this));this.countText=BX("bx-ilike-count-"+this.likeId);BX.bind(this.countText,"click",BX.proxy(this.list,this));return true},vote:function(e){clearTimeout(this.likeTimeout);if(BX.type.isBoolean(e)&&this.voted==e)return false;var t=BX.type.isNotEmptyString(this.countText.innerHTML)?parseInt(this.countText.innerHTML):0,i;i=this.voted=BX.type.isBoolean(e)?e:!this.voted;if(this.voted){this.countText.innerHTML=t+1;BX.addClass(this.box,"post-comment-likes-liked");BX.removeClass(this.box,"post-comment-likes");var s=BX.clone(this.box);var n=this.box;BX.adjust(n.parentNode,{style:{position:"relative"}});BX.adjust(s,{attrs:{id:"bx-ilike-button-animation"},style:{position:"absolute",minWidth:0}});BX.adjust(n,{style:{visibility:"hidden"}});n.parentNode.insertBefore(s,n);new BX.easing({duration:120,start:{scale:100},finish:{scale:130},transition:BX.easing.transitions.quad,step:function(e){s.style.transform="scale("+e.scale/100+")"},complete:function(){new BX.easing({duration:120,start:{scale:130},finish:{scale:100},transition:BX.easing.transitions.quad,step:function(e){s.style.transform="scale("+e.scale/100+")"},complete:function(){s.parentNode.removeChild(s);BX.adjust(n,{style:{visibility:"visible"}});BX.adjust(n.parentNode,{style:{position:"static"}})}}).animate()}}).animate()}else{this.countText.innerHTML=t-1;BX.addClass(this.box,"post-comment-likes");BX.removeClass(this.box,"post-comment-likes-liked")}if(BX.type.isBoolean(e)){return false}else{this.likeTimeout=setTimeout(BX.proxy(function(){this.send(i)},this),1e3);BX.eventCancelBubble(e);return BX.PreventDefault(e)}},send:function(e){var t=new window.MobileAjaxWrapper;t.Wrap({type:"json",method:"POST",url:BX.message("SITE_DIR")+"mobile/ajax.php?mobile_action=like",data:{RATING_VOTE:"Y",RATING_VOTE_TYPE_ID:this.entityTypeId,RATING_VOTE_ENTITY_ID:this.entityId,RATING_VOTE_ACTION:e===true?"plus":"cancel",sessid:BX.bitrix_sessid()},callback:BX.proxy(function(t){if(typeof t!="undefined"&&typeof t.action!="undefined"&&typeof t.items_all!="undefined"){this.vote(t.action=="plus");this.countText.innerHTML=t.items_all}else this.vote(!e)},this),callback_failure:BX.proxy(function(){this.vote(!e)},this)})},someoneVote:function(e,t){this.countText.innerHTML=t;if(t>1||t==1&&!this.voted){BX.addClass(this.box,"post-comment-liked")}else{BX.removeClass(this.box,"post-comment-liked")}},list:function(e){if(window["app"]){var t=BX.message("RVPathToUserProfile")?BX.message("RVPathToUserProfile"):BX.message("RVCPathToUserProfile");window.app.openTable({callback:function(){},url:(BX.message("MobileSiteDir")?BX.message("MobileSiteDir"):"/")+"mobile/index.php?mobile_action=get_likes&RATING_VOTE_TYPE_ID="+this.entityTypeId+"&RATING_VOTE_ENTITY_ID="+this.entityId+"&URL="+t,markmode:false,showtitle:false,modal:false,cache:false,outsection:false,cancelname:BX.message("RVCListBack")})}return BX.PreventDefault(e)}};window.RatingLikeComments.getById=function(t){return e[t]};window.RatingLikeComments.List=function(t){if(e[t])e[t].list()};if(window["RatingLikeCommentsQueue"]&&window["RatingLikeCommentsQueue"].length>0){var i;while((i=window["RatingLikeCommentsQueue"].pop())&&i){i()}delete window["RatingLikeCommentsQueue"]}})();
//# sourceMappingURL=script_attached.map.js